
<?php
global $base_url;

$rowPage = PAGE_LIMIT;
$pageTotal = ceil($countRow / $rowPage);

$maxPage = 10;

?>



<?php if ($scSoftwares) : ?>
  <h3>We has "<?php echo $countRow ?>" softwares</h3>
  <div>
    <?php foreach ($scSoftwares as $software) : ?>
      <div class="content-child">
        <div class="title"><a href="<?php echo $base_url . '/shortcut-keys/' . $software->scs_id . '/' . $software->scs_alias ?>"><?php echo $software->scs_name ?></a></div>
        <div class="description"><span class="span-date"><?php echo format_date(strtotime($software->date_create), 'custom', 'M d Y', null) ?></span>, <span class="span-user"><?php echo $software->name ?></span></div>
      </div>
    <?php endforeach; ?>
  </div>
<?php endif; ?>

<?php
if ($pageTotal > 1) {
  $ul = '<ul class="pager">';
  for ($i = 1; $i <= $pageTotal; $i++) {
    $class = '';
    if ($page == $i) {
      $class .= 'class="active"';
    }
    $ul .= '<li ' . $class . '><a href="?page=' . $i . '">' . $i . '</a></li>';
  }
  if ($pageTotal > $maxPage) {
    $ul .= '<li ' . $class . '><a href="?page=' . $i . '">Next</a></li>';
  }
  $ul .= '</ul>';
  echo $ul;
}
?>